package com.supor.aiot.mine.ui.adapter;

import android.view.View;

import com.android.baseconfig.recyclerview.adapter.BaseByViewHolder;
import com.android.baseconfig.recyclerview.adapter.BaseRecyclerAdapter;
import com.supor.aiot.mine.R;
import com.supor.aiot.mine.bean.FunctionIntroductionItem;

import java.util.List;

public class FunctionIntroductionAdapter extends BaseRecyclerAdapter<FunctionIntroductionItem> {

    private List<FunctionIntroductionItem> functionIntroductionItems;

    public void setFunctionIntroductionItems(List<FunctionIntroductionItem> functionIntroductionItems) {
        this.functionIntroductionItems = functionIntroductionItems;
    }

    public FunctionIntroductionAdapter(List<FunctionIntroductionItem> data) {
        super(R.layout.item_function_introduction, data);
        functionIntroductionItems = data;
    }

    @Override
    protected void bindView(BaseByViewHolder<FunctionIntroductionItem> holder, FunctionIntroductionItem bean, int position) {
        if (position == functionIntroductionItems.size() - 1) {
            holder.itemView.findViewById(R.id.fl_line).setVisibility(View.GONE);
        } else {
            holder.itemView.findViewById(R.id.fl_line).setVisibility(View.VISIBLE);
        }

        holder.setText(R.id.tv_introduction_title, bean.getTitle());
        holder.setText(R.id.tv_date, bean.getDate());
        holder.setText(R.id.tv_introduction_content, bean.getContent());
    }
}
